<?php
$page->BodyId = 'post';
$page->BodyClass = '';
$page->Section = '';

if ( !$page->Ajax ) {
	$page->Title = $page->Wordlets->GetWordlet('page_title');
	$page->SetWrapperFile('_wrapper');
}

?>

<div id="post">
	<h5>Post</h5>
	<? if ( $page->Errors ): ?>
		<div id="error">
			<p>
				We had some issues submitting this form:
			</p>
			<? if ( isset($page->Errors['form']) ): ?>
				<p class="error">
					<?=implode(',', $page->Errors['form']) ?>
				</p>
			<? endif ?>
		</div>
	<? endif ?>
	<form action="<?=$page->FormUrl?>" method="post">
		<fieldset>
			<input type="hidden" name="form_id" value="<?=$page->FormId?>" />
			<p id="post_title" class="input text <?=( $page->Errors && isset($page->Errors['title']) )?'error':''?>">
				<? if ( $page->Errors && isset($page->Errors['title']) ) { ?>
					<span class="error">
						<?=implode(',', $page->Errors['title']) ?>
					</span>
				<? } ?>
				<label for="title"><?=$page->Wordlets->Get('form_field_title')?>:</label>
				<input type="text" name="title" id="title" value="<?=$page->FormTitle?>" />
			</p>
			<p id="post_body" class="input textarea <?=( $page->Errors && isset($page->Errors['body']) )?'error':''?>">
				<? if ( $page->Errors && isset($page->Errors['body']) ) { ?>
					<span class="error">
						<?=implode(',', $page->Errors['body']) ?>
					</span>
				<? } ?>
				<label for="body">Body:</label>
				<textarea name="body" id="body"><?=$page->FormBody?></textarea>
			</p>
			<p class="input submit"><input type="submit" value="Post" /></p>
		</fieldset>
	</form>
</div>